package com.itheima_01;

import java.util.Scanner;

public class StringDemo3 {
    public static void main(String[] atgs) {
        String username = "12345@163.com";
        String password = "12345";
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String s1 = sc.nextLine();
        if (s1.equals(username) == false) {
            System.out.println("您输入的用户名有误。");
        } else {
            System.out.println("请输入密码：");
            for (int i = 0; i < 3; i++) {
                String s2 = sc.nextLine();
                if (s2.equals(password) == true) {
                    System.out.println("登录成功！");
                    break;
                } else {
                    if (i < 2) {
                        System.out.println("登录失败，您还有" + (2-i) + "次机会，请重新登陆：");
                    } else {
                        System.out.println("登录失败，您的账号已锁定。");
                    }
                }
            }
        }
    }
}
